<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2_AngularJS函数库2</title>
    <script src="../lib/angularjs.js"></script>
</head>

<body ng-app="myApp" ng-controller="myCtrl">
    <div>dom element</div>
</body>

<script>
    const myApp = angular.module("myApp", [])
    myApp.controller("myCtrl", ["$scope", function ($scope) { }])

    // 9、angular.isArray，该方法判断一个目标是否是 Array。 
    let arrayData = [1, 2, 3]
    console.log("angular.isArray-arrayData：", arrayData, angular.isArray(arrayData));

    // 10、angular.isDate，该方法判断目标是否是 Date。
    let date = new Date()
    console.log("angular.isDate-date：", date, angular.isDate(date));

    // 11、angular.isDefined，该方法判断目标是否已定义。。
    let definedTarget = 123;
    console.log("angular.isDefined-definedTarget：", definedTarget, angular.isDefined(definedTarget));

    // 12、angular.isUndefined，该方法判断目标是否未定义。
    let undefinedTarget;
    console.log("angular.isDefined-undefinedTarget：", undefinedTarget, angular.isUndefined(undefinedTarget));

    // 13、angular.isFunction，该方法判断目标是否是 Function。
    let func = function () { };
    console.log("angular.isFunction-func：", func, angular.isFunction(func));

    // 14、angular.isNumber，该方法判断目标是否是 Number。
    let num = 123;
    console.log("angular.isNumber-num：", num, angular.isNumber(num));

    // 15、angular.isObject，该方法判断目标是否是 Object。
    let obj = {};
    console.log("angular.isObject-obj：", obj, angular.isObject(obj));

    // 16、angular.isString，该方法判断目标是否是 String。 
    let str = "ABC";
    console.log("angular.isString-str：", str, angular.isString(str));

    // 17、angular.isElement，该方法判断目标是否是 dom 元素。 
    let dom = document.getElementsByTagName("div")[0]
    console.log("angular.isElement-dom：", dom, angular.isElement(dom));

    // 18、angular.equals，该方法判断两个目标是否相等。 
    console.log("angular.equals-Start：");
    let tar1 = { a: 1 }
    let tar11 = { a: 1 }
    let objEquals = angular.equals(tar1, tar11)
    console.log("tar1：", tar1, "tar11：", tar11, "tar1 equals tar11：", objEquals);
    let tar2 = 123
    let tar22 = 123
    let numEquals = angular.equals(tar2, tar22)
    console.log("tar2：", tar2, "tar22：", tar22, "tar2 equals tar22：", numEquals);
    let tar3 = [11, 22]
    let tar33 = [11, 22]
    let arrEquals = angular.equals(tar3, tar33)
    console.log("tar3：", tar3, "tar33：", tar33, "tar3 equals tar33：", arrEquals);
    let tar4 = "ABC"
    let tar44 = "ABC"
    let strEquals = angular.equals(tar4, tar44)
    console.log("tar4：", tar4, "tar44：", tar44, "tar4 equals tar44：", arrEquals);
    console.log("angular.equals-End：");
</script>

</html>